package com.mobi.Survey.map;

import java.util.ArrayList;
import java.util.List;

public class Category implements Cloneable, Comparable<Category> {

	private long id;
	private String name;
	private List<Category> subCategories = new ArrayList<Category>();

	public Category() {

	}

	public Category(long id, String name) {
		this.id = id;
		this.name = name;
	}

	public List<Category> getSubCategories() {
		return subCategories;
	}

	public void setSubCategories(List<Category> subCategories) {
		this.subCategories = subCategories;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int hashCode() {

		return name.hashCode();
	}

	@Override
	protected Object clone() {

		return new Category(id, name);
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return name;
	}

	@Override
	public boolean equals(Object o) {
		if (o == null || !(o instanceof Category)) {
			return false;
		}
		return this.getName().equals(((Category) o).getName());
	}

	@Override
	public int compareTo(Category cat) {
		return this.name.compareTo(cat.name);

	}
}
